package com.codingbingo.fastreader.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.codingbingo.fastreader.dao.Book;
import com.codingbingo.fastreader.dao.Chapter;

import com.codingbingo.fastreader.dao.BookDao;
import com.codingbingo.fastreader.dao.ChapterDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig bookDaoConfig;
    private final DaoConfig chapterDaoConfig;

    private final BookDao bookDao;
    private final ChapterDao chapterDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        bookDaoConfig = daoConfigMap.get(BookDao.class).clone();
        bookDaoConfig.initIdentityScope(type);

        chapterDaoConfig = daoConfigMap.get(ChapterDao.class).clone();
        chapterDaoConfig.initIdentityScope(type);

        bookDao = new BookDao(bookDaoConfig, this);
        chapterDao = new ChapterDao(chapterDaoConfig, this);

        registerDao(Book.class, bookDao);
        registerDao(Chapter.class, chapterDao);
    }
    
    public void clear() {
        bookDaoConfig.clearIdentityScope();
        chapterDaoConfig.clearIdentityScope();
    }

    public BookDao getBookDao() {
        return bookDao;
    }

    public ChapterDao getChapterDao() {
        return chapterDao;
    }

}
